import vue from '@vitejs/plugin-vue';
import { defineConfig, loadEnv, ConfigEnv } from 'vite';
import {createSvgIconsPlugin} from 'vite-plugin-svg-icons';
import path from 'path'

const viteConfig = defineConfig((mode: ConfigEnv) => {
	const env = loadEnv(mode.mode, process.cwd());
	return {
		plugins: [
			createSvgIconsPlugin({
        // 指定需要缓存的图标文件夹
        iconDirs: [path.resolve(process.cwd(), 'src/icons/svg')],
        // 指定symbolId格式
        symbolId: 'icon-[dir]-[name]',
      }),
			vue(), 
		],
	};
});

export default viteConfig;
